import pika

# Connection parameters
credentials = pika.PlainCredentials('XuYixuan', 'Xyx20040422')
connection = pika.BlockingConnection(pika.ConnectionParameters('82.156.163.134', 5672, '/', credentials))
channel = connection.channel()

# Declare a queue
channel.queue_declare(queue='user_actions')

# Callback function to process messages
def callback(ch, method, properties, body):
    print(f"收到消息: {body.decode('utf-8')}")

# Consume messages
channel.basic_consume(queue='user_actions', on_message_callback=callback, auto_ack=True)

print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()